<h1>Listing users</h1>

<% link_to new_user_path, :class => 'ui-state-default ui-corner-all dialog_link' do %>
	<span class="ui-icon ui-icon-plus"></span>New user
<% end %>

<table>
	<tr class="ui-state-default">
		<th>Login</th>
		<th>Email</th>
		<th></th>
	</tr>
	
	<% @users.each do |user| %>
		<tr>
			<td><%=h user.login %></td>
			<td><%=h user.email %></td>
			<td>
				<% if logged_in? %>
					<% link_to user, :confirm => 'Are you sure ?', :method => :delete, :class => "ui-state-error ui-corner-all dialog_link ui-state-hover" do %>
						<span class="ui-icon ui-icon-close"></span>Destroy
					<% end %>
				<% else %>
						<a class="ui-state-error ui-state-disabled ui-corner-all dialog_link"><span class="ui-icon ui-icon-key"></span>You need to be logged</a>
				<% end %>
			</td>
		</tr>
	<% end %>
</table>